package com.justspeak.module;

import java.util.List;

public class UnitInfo {
    private String id;
    private String unit;
    private String book;
    private String title;

    private boolean checked;

    private int courseCount;

    private List<CourseInfo> children;

    /***
     * 空构造函数
     */
    public UnitInfo(String title, String unit, boolean checked,
	    int courseCount, List<CourseInfo> children) {
	this.unit = unit;
	this.title = title;
	this.checked = checked;
	this.courseCount = courseCount;
	this.children = children;
    }

    public UnitInfo() {

    }

    public void setChecked(boolean checked) {
	this.checked = checked;

	if (getChildren() != null && getChildren().size() > 0) {// 若children不为空，循环设置children的checked

	    for (CourseInfo each : getChildren()) {

		each.setChecked(checked);

	    }

	}
    }

    public boolean getChecked() {

	return checked;

    }

    public void setChildren(List<CourseInfo> children) {
	this.children = children;
    }

    public List<CourseInfo> getChildren() {
	return children;
    }

    public void setCourseCount(int courseCount) {
	this.courseCount = courseCount;
    }

    public int getCourseCount() {
	return courseCount;
    }

    public void setTitle(String title) {
	this.title = title;
    }

    public String getTitle() {
	return title;
    }

    public void setId(String id) {
	this.id = id;
    }

    public String getId() {
	return id;
    }

    public void setBook(String book) {
	this.book = book;
    }

    public String getBook() {
	return book;
    }

    /**
     * @param unit
     *            赋值 unit
     */
    public void setUnit(String unit) {
	this.unit = unit;
    }

    /**
     * @return unit
     */
    public String getUnit() {
	return unit;
    }

}
